/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package org.base;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author mmanto
 */
@Entity
@Table(name = "dato_del_dominio")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "DatoDelDominio.findAll", query = "SELECT d FROM DatoDelDominio d"),
    @NamedQuery(name = "DatoDelDominio.findById", query = "SELECT d FROM DatoDelDominio d WHERE d.id = :id"),
    @NamedQuery(name = "DatoDelDominio.findByVersion", query = "SELECT d FROM DatoDelDominio d WHERE d.version = :version"),
    @NamedQuery(name = "DatoDelDominio.findByNombre", query = "SELECT d FROM DatoDelDominio d WHERE d.nombre = :nombre")})
public class DatoDelDominio implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "id")
    private Long id;
    @Basic(optional = false)
    @NotNull
    @Column(name = "version")
    private long version;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 255)
    @Column(name = "nombre")
    private String nombre;
    @OneToMany(mappedBy = "datoDelDominioId")
    private Collection<Barrio> barrioCollection;

    public DatoDelDominio() {
    }

    public DatoDelDominio(Long id) {
        this.id = id;
    }

    public DatoDelDominio(Long id, long version, String nombre) {
        this.id = id;
        this.version = version;
        this.nombre = nombre;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public long getVersion() {
        return version;
    }

    public void setVersion(long version) {
        this.version = version;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    @XmlTransient
    public Collection<Barrio> getBarrioCollection() {
        return barrioCollection;
    }

    public void setBarrioCollection(Collection<Barrio> barrioCollection) {
        this.barrioCollection = barrioCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DatoDelDominio)) {
            return false;
        }
        DatoDelDominio other = (DatoDelDominio) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.base.DatoDelDominio[ id=" + id + " ]";
    }
    
}
